
<template>
  <div class="top">
    <!--  内容区域  -->
    <div class="content">
      <!--左侧-->
      <div class="left">
        <img src="" alt="">
        <p>文件管理系统</p>
      </div>
      <!--右侧-->
      <div class="right">
        <div><el-button type="primary" :icon="Avatar" circle /></div>
        <el-popover
          placement="bottom"
          :width="150"
          trigger="hover"
        >
        <ul>
          <li @click="changePwd">修改密码</li>
          <li @click="getout">退出登录</li>
        </ul>
          <template #reference>
            <div class="text">
              <p class="login">{{ username }}</p>
              <el-icon><CaretBottom /></el-icon>
            </div>
          </template>
        </el-popover>
        <div class="store-1"><img @click="goStore" src="../../assets/images/gitee-logo.png" alt=""></div>
      </div>
    </div>
    <!-- 修改密码弹框 -->
    <UpdatePwd :showPwd="showPwd" @closePwd = "closePwd"></UpdatePwd>
  </div>
</template>
<script setup lang="ts">
import {Avatar,CaretBottom,Edit} from '@element-plus/icons-vue'
import { onMounted, ref } from 'vue';
import $store from '@/vuex/store';
import UpdatePwd from '@/components/update_pwd/index.vue';
import { useRouter } from 'vue-router';
import '@/assets/fonts/font.css';
// 创建路由器对象
const $router = useRouter();
let showPwd = ref(false);
let username = ref('');
const changePwd =  (()=>{
  showPwd.value = true;
})
const getout = (()=>{
  //清除浏览器仓库内容和浏览器本地缓存
  localStorage.clear;
  $store.commit('REMOVE');
  $router.push('/login');
})
const closePwd =((value)=>{
  showPwd.value = value;
})
const goStore = (()=>{
  window.open('https://gitee.com/wu-hongkunlihuan/file-elfinder-management', '_blank');
})
onMounted(()=>{
  username.value = localStorage.getItem('username');
})
</script>
<script lang="ts">
export default {
  name: 'HospitalTop',
}
</script>
<style lang="scss" scoped>
.top{

  box-shadow: rgb(203, 201, 201) 0 1px;
  z-index: 999;
  top: 0;
  width: 100%;
  height: 70px;
  background-color: white;
  display: flex;
  justify-content: center;
  position: fixed;
  .content{
    background-color: white;
    width: 95%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    .left{
      display: flex;
      justify-content: center;
      align-items: center;
      img{
        height: 60px;
      }
      img:hover{
        cursor: pointer;
      }
      p{
        margin-left: 20px;
        font-size: 40px;
        font-family: 'Title';
        color: #5b86e5;
      }
    }
    .right{
      all: unset;
      width: 200px;
      display: flex;
      align-items: center;
      color: gray;
      font-size: 15px;
      img{
        border-radius: 50%;
        width: 40px;
      }
      .text{
        margin-left: 10px;
        margin-right: 50px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      p:hover{
        cursor:pointer;
        color: #5b86e5;
      }
    }
  }
}
</style>
<style>
ul{
  padding: 0;
  margin: 0;
  li{
    list-style-type: none;
    line-height: 35px;
    /* width: 125px; */
    text-align: center;
  }
  li:hover{
    cursor: pointer;
    background-color: rgb(239, 237, 237);
    color: #409eff;
  }
}
</style>
